package zuoye3;

public class zuoye04 {
	public static void main(String[] args){
		int sum=0;
		for(int i=1;i<1000;i++){
			boolean pd1=suShu(i);
			boolean pd2=huiWen(i);
			if(pd1&&pd2){
				sum++;
				System.out.print(i+" ");
				if(sum%10==0){
					System.out.println();
				}
			}
		}	
	}

	private static boolean huiWen(int i) {
		if(i<10){
			return true;
		}else if(i<100){
			int ge=i%10;
			int shi=i/10;
			if(ge==shi){
				return true;
			}
		}else if(i>99){
			int ge = i%10;
			int shi = i/10%10;
			int bai = i/100;
			if(ge==bai){
				return true;
			}
		}
		return false;
	}

	private static boolean suShu(int num) {
		int count=0;
		for(int i=1;i<=num;i++){
			if(num%i==0){
				count++;
			}
		}
		if(count==2){
			return true;
		}
		return false;
	}
}
